 $(function(){
	
	easyloader.base = '../../js/tools/locale/';
    easyloader.load('easyui-lang-zh_CN.js', function(){     
	 $("#dialog").window({
        closed: true,
        modal: true,
		height: 95,
		width:220,
		left:"40%"
    });
	    var pram={title:''};
         $("#dataGrid").datagrid({
				        height: 450,
						width:1140,
                        pagination: true,
						rownumbers:true,
						striped:true,
						pageList:[15,20,25,30],
						pageSize:15,
						showPageList:true,
						singleSelect:true,
						queryParams:pram,
                        url: '../../groupbyajax/system!menageCulmn.action',
                        columns: [[
						          {field: 'category',title: '类别',width: 150,align: 'left'},
						          {field: 'content',title: '内容',width: 300,align: 'center'},
								  {field: 'modify',title: '修改',width:80,align: 'center'},
								  {field: 'del',title: '删除',width:80,align: 'center'}
							 ]]
						
			        });		 
			});	
});	
/**
 * 显示
 */
function showColumn(field)
{
	$(".datagrid-view2 .datagrid-header div table tr th").each(function(){
		if($(this).attr("field")==field)
		{
			$(this).show();
			return false;
		}
	});
$(".datagrid-column-"+field).show();
}
/**
 * 隐藏
 * @param {Object} field
 */
function hideColumn(field)
{	
$(".datagrid-view2 .datagrid-header div table tr th").each(function(){
		if($(this).attr("field")==field)
		{
			$(this).hide();
			return false;
		}
	});
$(".datagrid-column-"+field).hide();
}
function addButton()
{
	
var pager = $('#dataGrid').datagrid('getPager');   
					pager.pagination({
						pageList:[15,20,25,30],
						pageSize:15,
						showPageList:true,
						buttons:[{
							iconCls:'icon-print',
							handler:function(){
								doPrint();
							}
						}]
					});
}

function delculmn(id)
{
	$.messager.confirm('删除', '你确定要删除记录吗?', function(r){
		                          if(r)
								  {
	$.getJSON("../../groupbyajax/system!delculmn.action",{id:id},function(data){
		if(data.success)
		{
			$("#dataGrid").datagrid('reload');
		}
	})
	}
	});
}
function addCulmn()
{
	$("#dialog").window("open");
}
function save()
{
	var category=$.trim($("#category").val());
	if(category.length<1||category.length>30)
	{
		alert("名称字数在1~30之间!");
		return false;
	}
	$.getJSON("../../groupbyajax/system!addculmn.action",{title:category},function(data){
		if(data.success)
		{
			$("#dataGrid").datagrid('reload');
			
		}
		$("#dialog").window("close");
	});
}
function search()
{
	var title=$("#title").val();
	
	$('#dataGrid').datagrid({
				  striped: true,
				  queryParams:{title:title}
			   });
}
